package com.sunlong.jiangwei.dao;

import com.sunlong.jiangwei.entity.JwRole;
import com.sunlong.jiangwei.entity.JwUser;
import com.sunlong.jiangwei.entity.JwUserRole;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Select;
import tk.mybatis.mapper.common.Mapper;

import java.util.List;

public interface RoleMapper extends Mapper<JwRole> {

    /**
     * 根据roleId查询用户角色表
     * @param id
     */
    @Select("select * from jw_user_role where role_id = #{id}")
    List<JwUserRole> selectUserRoleByRoleId(Long id);


    /**
     * 根据id查询角色
     * @param id
     * @return
     */
    @Select("select * from jw_role where role_id = #{id}")
    JwRole selectRoleById(Long id);

    /**
     * 根据id删除角色
     * @param id
     */
    @Delete("delete from jw_role where role_id = #{id}")
    void deleteRoleByid(Long id);
}
